package basic;

public class RegularBike extends Bike {

    private static int ppd = 20; // price per day
    private static int maxDist = 5000; // bike is serviced every maxDist kilometers

    public RegularBike() {
        this.setId(Bike.getCurrId());
    }

    @Override
    public int getPpd() {
        return RegularBike.ppd;
    }

    @Override
    public int getMaxDist() {
        return RegularBike.maxDist;

    }

    @Override
    public void changeMileage(int k) {
        this.mileage = this.mileage + k;
        int g = (int) (this.mileage / RegularBike.maxDist); /// ????

        if (g >= 1) {

            this.setNeedService(true);
            this.serviceCount++;
            this.mileage -= RegularBike.maxDist;
        }
    }

    @Override
    public String toString() {
        // id model wheelsize total_mileage mileage_to_serive
        return String.format("%4d %20s %10d %6d %10d",
                this.getId(), this.getModel(), this.getWheelSize(),
                (this.getServiceCount() * this.getMaxDist() + this.getMileage()),
                this.getMaxDist() - this.getMileage());
    }

}
